/*This file is part of AENIMA. AENIMA is a module of BCI++ framework for the implementation of brain computerinterface systems. 
AEnima is intended for use with BCI++ only.

BCI++ is a project of the Sensibilab of the Politecnico di Milano. 

AENIMA is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as 
published by the Free Software Foundation, either version 3 of 
the License, or (at your option) any later version.

AENIMA is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Lesser General Public License for more details.

You should have received a copy of the GNU General Public License
and the GNU Lesser General Public License along with AENIMA.  
If not, see <http://www.gnu.org/licenses/>.*/

/*!
	\file	GraphicEngine_base.h
	 This file contains GraphicEngine_base class. This class allow to create dynamic library and exchange data with
	 the main program.

	\author	Sensibilab EMail: info.sensibilab@polimi.it

	\date	2007-09-06 creation \n
		2009-01-27 last modification

	\b COPYRIGHT: 
		This program is property of Sensibilab - Campus Ponit - Lecco
*/

#pragma once
#include "Constants.h"
#include "CReflectedWater.h"
#include "CSkyBoxSceneNode.h"
extern "C"
{
	#include "CEffects.h"
}
#include "TGM\PostProcess\Bloom\PostProcessBloom.h"
#include "TGM\PostProcess\Color\PostProcessColor.h"


using namespace irr;

#pragma comment(lib, "Irrlicht.lib")

/*!\class GraphicEngine_base
Class for the graphics management. View GraphicEngine documentation in AEnima doc for more details.*/
class GraphicEngine_base
{
protected:
	SKeyMap keyMap[4];
	core::stringw WinTitle;
	// Engine Configuration Parameters
	video::E_DRIVER_TYPE driverType;
	IEventReceiver* myRecv;
public:
	IrrlichtDevice* device;
	video::IVideoDriver* driver;
	scene::ISceneManager* smgr;
	gui::IGUIEnvironment* env;
	scene::ICameraSceneNode* camera;
	scene::ISceneNode* skydome;
	scene::ISceneCollisionManager* cmgr;
	scene::ISceneNodeAnimator* anim;
	scene::ISceneNodeAnimator* movement;
	gui::IGUIInOutFader* fader;
	

public:
	GraphicEngine_base(void);
	virtual ~GraphicEngine_base(void);
	virtual void AnimatedSkydome(char *SkyTexPath);
	virtual void EnvironmentalDrawings(void);
	virtual void ObjectDrawings(void);
	virtual void ExEngine(void);
	virtual void FlushAll(void);
	virtual void LoadBuiltInResources(void);
	virtual void RestartEngine(void);
	virtual void InitEngine(void);
	virtual void ConfigEngine(char *driverSelected,int hres,int vres, char *mode, char* bitcolor, char* vsinch);
	virtual void DrawCentered2DImage(video::ITexture* CenterTexture);

	virtual scene::IParticleSystemSceneNode* ParticleSystem(scene::ISceneNode* ParentNode,core::vector3df Position, core::vector3df EmiDirection, u32 nMin,u32 nMax, video::SColor MinStartColor, video::SColor MaxStartColor, s32 Angle);

	virtual void RealisticWaterNode(f32 tileSize, u32 tileCount, core::dimension2di RenderTargetSize);
	bool renderWater;
	bool renderEffects;
	CReflectedWater *waternode;

	typedef struct postproc{
		// POST PROCESSING SHADERS
		IPostProcessBloom *Bloom;
		PPE_Bloom_Setup BloomSetup;
		bool renderBloom;

		IPostProcessColor *Color;
		PPE_Color_Setup ColorSetup;
		bool renderColor;
	} postproc;
	postproc ShaderFX;
	virtual void GLShaderFX(bool BloomON,bool ColorON);

	int HRES,VRES;
	int COLORBIT;
	bool VSINC;
	bool FULLSCREEN;

};